package com.paper.entity;


import java.util.HashMap;
import java.util.Map;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.MapKeyColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;


@Entity
@Table(name="t_topics")
public class Topics {//大题
	private Long id;
	private Integer _index;
	private String title;
	private boolean isCompreh;//是否是综合题目
	private Map<Integer,Subtopics> subtopics = new HashMap<Integer,Subtopics>();
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}

	public Integer get_index() {
		return _index;
	}
	@Column(length=8000)
	public String getTitle() {
		return title;
	}
	@OneToMany(fetch=FetchType.EAGER,cascade=CascadeType.ALL)
	@JoinTable(name="t_topics_subtopics",inverseJoinColumns=@JoinColumn(name="subtopics_id"))
	@MapKeyColumn(name="subtopics_key")
	public Map<Integer,Subtopics> getSubtopics() {
		return subtopics;
	}
	
	public boolean isCompreh() {
		return isCompreh;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public void set_index(Integer _index) {
		this._index = _index;
	}

	public void setTitle(String title) {
		this.title = title;
	}
	public void setSubtopics(Map<Integer,Subtopics> subtopics) {
		this.subtopics = subtopics;
	}

	public void setCompreh(boolean isCompreh) {
		this.isCompreh = isCompreh;
	}
	
}
